#页面类
from Day16zy.Base import Base
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from time import sleep
class Page(Base):
    #定位器
    search_loc=(By.NAME,'key')
    #页面元素的封装
    # 输入账号
    username=(By.NAME,'email')
    # 输入密码
    passwoed=(By.NAME,'password')
    # 点击登录
    button=(By.XPATH,'//*[@id="dologin"]')

    def search(self):
        #进入框架
        f = self.driver.find_element(By.XPATH, '//iframe[starts-with(@id,"x-URS-iframe174340")]')
        self.driver.switch_to.frame(f)
        sleep(5)
        # 输入账号
        self.send_keys(self.username,'17733058407')
        sleep(2)
        # 输入密码
        self.send_keys(self.passwoed, 'LCf10140910')
        sleep(2)
        # 点击登录按钮
        self.click(self.button)
        sleep(10)

    #业务逻辑
    def luoji_jiuxian_01(self):
        self.open_url('https://mail.163.com/')
        self.search()
        sleep(5)